import { DcsModel } from '@/api/manager/dcs/interface'
import { InteractiveModel } from '@/api/manager/interactive/interface'
import { OftenModel } from '@/api/manager/often/interface'
import { OrgModel } from '@/api/manager/organize/interface'
import { useActionButtonsStore } from './blocks/main/actionButtons/store'
import { useTableAllStore } from './blocks/main/table/all/store'
import { ViewMccModel } from './blocks/main/table/all/translator'
import { useTableDcsStore } from './blocks/main/table/dcs/store'
import { useTableInteractiveStore } from './blocks/main/table/interactive/store'
import { useTableOftenStore } from './blocks/main/table/often/store'
import { useTableOrgStore } from './blocks/main/table/organize/store'
export const tableAllItemCheck = ({ status }: ViewMccModel) => {
	const screenButtonList = useActionButtonsStore.getState().screenList
	if (screenButtonList.length === 0) return
	const tree = useTableAllStore.getState().tree
	status.isChecked = !status.isChecked
	useTableAllStore.setState({
		tree: { ...tree },
	})
}
export const tableOftenItemCheck = ({ status }: OftenModel) => {
	const screenButtonList = useActionButtonsStore.getState().screenList
	if (screenButtonList.length === 0) return
	const list = useTableOftenStore.getState().list
	status.isChecked = !status.isChecked
	useTableOftenStore.setState({
		list: [...list],
	})
}
export const tableOrgItemCheck = ({ status }: OrgModel) => {
	const screenButtonList = useActionButtonsStore.getState().screenList
	if (screenButtonList.length === 0) return
	const list = useTableOrgStore.getState().list
	status.isChecked = !status.isChecked
	useTableOrgStore.setState({
		list: [...list],
	})
}
export const tableInteractiveItemCheck = ({ status }: InteractiveModel) => {
	const screenButtonList = useActionButtonsStore.getState().screenList
	if (screenButtonList.length === 0) return
	const list = useTableInteractiveStore.getState().list
	status.isChecked = !status.isChecked
	useTableInteractiveStore.setState({
		list: [...list],
	})
}
export const tableDcsItemCheck = ({ status }: DcsModel) => {
	const screenButtonList = useActionButtonsStore.getState().screenList
	if (screenButtonList.length === 0) return
	const list = useTableDcsStore.getState().list
	status.isChecked = !status.isChecked
	useTableDcsStore.setState({
		list: [...list],
	})
}
